//
//  LargeGoodsViewController.m
//  WorkNest
//
//  Created by qbm360 on 15/7/30.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "LargeGoodsViewController.h"
#import "SlideSwitchView.h"
//#import "user_myAllProductViewController.h"
#import "LargeGoodsTableViewController.h"

@interface LargeGoodsViewController () <SlideSwitchViewDelegate>

@property (weak, nonatomic) IBOutlet SlideSwitchView *slideSwitchView;
@property (nonatomic, strong)LargeGoodsTableViewController *waittingReceive;
@property (nonatomic, strong)LargeGoodsTableViewController *received;
@property (nonatomic, strong)LargeGoodsTableViewController *waittingPay;

@end

@implementation LargeGoodsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self titleView:@"我的大货单"];
    
    _slideSwitchView.tabItemNormalColor = [UIColor grayColor];
    _slideSwitchView.tabItemSelectedColor = [UIUtil colorWithHexString:@"#fc7b1a"];
    _slideSwitchView.shadowImage = [UIImage imageNamed:@"TabSelectedBackground"];
    _slideSwitchView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    _slideSwitchView.slideSwitchViewDelegate = self;

    _waittingReceive = [[LargeGoodsTableViewController alloc] init];
    _waittingReceive.title = NSLocalizedString(@"待收货", nil);
    _waittingReceive.largeGoodsType = WaittingReceive;
    
    _received = [[LargeGoodsTableViewController alloc] init];
    _received.title = NSLocalizedString(@"已收货", nil);
    _received.largeGoodsType = AlreadyReceive;
    
    _waittingPay = [[LargeGoodsTableViewController alloc] init];
    _waittingPay.title = NSLocalizedString(@"待付款", nil);
    _waittingPay.largeGoodsType = WaittingPaying;
    
    [_slideSwitchView buildUI];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"reloadBulkorder" object:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - SlideSwitchViewDelegate
- (NSUInteger)numberOfTab:(SlideSwitchView *)view
{
    return 3;
}

- (UIViewController *)slideSwitchView:(SlideSwitchView *)view viewOfTab:(NSUInteger)number
{
    if (number == 0) {
        return _waittingReceive;
    } else if (number == 1) {
        return _received;
    } else if (number == 2) {
        return _waittingPay;
    } else {
        return nil;
    }
}

@end
